<?php
    include_once("Configs/database.php");
    include_once("LopHocPhan.php");
    class ThoiKhoaBieu extends LopHocPhan{
        private $malophp;
        private $thu;
        private $tietbd;
        private $sotiet;
        private $maphong;
        //private $tuanhoc;
        public function setMaLopHP($malophp){
            $this->malophp = $malophp;
        }
        public function getMaLopHP(){
            return $this->malophp;
        }
        public function setThu($thu){
            $this->thu = $thu;
        }
        public function getThu(){
            return $this->thu;
        }
        public function setTietBD($tietbd){
            $this->tietbd = $tietbd;
        }
        public function getTietBD(){
            return $this->tietbd;
        }
        public function setSoTiet($sotiet){
            $this->sotiet = $sotiet;
        }
        public function getSoTiet(){
            return $this->sotiet;
        }
        public function setMaPhong($phong){
            $this->maphong = $phong;
        }
        public function getMaPhong(){
            return $this->maphong;
        }
        
        public function themThoiKhoaBieu(){
            $query = "insert into ThoiKhoaBieu(malophp,thu,tietbd,sotiet,maphong) values('".$this->getMaLopHP()."',";
            $query .= "".$this->getThu().",".$this->getTietBD().",".$this->getSoTiet().",'".$this->getMaPhong()."')";
            $this->setQuery($query);
			
            return $this->executeQuery();
        }
        public function suaThoiKhoaBieu(){
            $query = "update ThoiKhoaBieu set sotiet=".$this->getSoTiet().",maphong='".$this->getMaPhong()."' where malophp='".$this->getMaLopHP()."' and thu=".$this->getThu()." and tietbd=".$this->getTietBD()."";
            $this->setQuery($query);
            return $this->executeQuery();
        }
        public function xoaThoiKhoaBieu(){
            $this->setQuery("delete from ThoiKhoaBieu where malophp='".$this->getMaLopHP()."' and thu=".$this->getThu()." and tietbd=".$this->getTietBD()."");
            return $this->executeQuery();
        }
        public function thongTinThoiKhoaBieu(){
            $this->setQuery("select * from ThoiKhoaBieu where malophp='".$this->getMaLopHP()."' and thu=".$this->getThu()." and tietbd=".$this->getTietBD()."");
            //echo $this->getQuery();
            return $this->fetchAll();
        }
        public function thoiKhoaBieuLopHP(){
            $this->setQuery("select * from ThoiKhoaBieu where malophp='".$this->getMaLopHP()."' order by thu");
            return $this->fetchAll();
        }
        //public function xepPhong(){
            /*$query = "select maphong from Phong where maphong not in "; 	           
            $query .= "(select a.maphong from ThoiKhoaBieu a, Phong b ";			
            $query .= "where a.maphong = b.maphong and (succhua<".$siso." or (thu=".$thu."  and ";
            $query .= "(((".$tietbd."+".$sotiet."-1)>=tietbd and (tietbd+sotiet-1)>=(".$tietbd."+".$sotiet."-1)) or ((tietbd+sotiet-1)=".$tietbd.") or (tietbd=(".$tietbd."+".$sotiet."-1))))))";*/

        //}
        
    }
?>